<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="prc.*" %>  

<%
  	String error="";
  	String username = request.getParameter("username");
  	String password = request.getParameter("password");
  	String visible = request.getParameter("viewonline");
  	User user=UserManagement.getUserByUsername(username);

  	if(user==null){
  		error+="<dl><dd class=\"error\">Username/password invalid</dd></dl>";
  	}
  	else{
  		
  		if(user.getPassword().equals(password)){
  			
  	UserManagement.login(session,username,visible!=null);
  		}
  		else{
  	error+="<dl><dd class=\"error\">Username/password invalid</dd></dl>";
  		}
  	}
  %>


<jsp:include page="top.jsp"/>



<div id="page-body">


	<div class="panel">
		<div class="inner"><span class="corners-top"><span></span></span>
		<h2>Forum - Registration</h2>
		<fieldset class="fields2">
		<%
		if(error.length()>0){
			out.println(error);
		}
		else{
			response.sendRedirect("index.jsp");
		}
		%>
		
	
		</fieldset>
	</div>
	<div class="panel">
		<div class="inner"><span class="corners-top"><span></span></span>
	
		<span class="corners-bottom"><span></span></span></div>
	</div>


</div>


</div>

<jsp:include page="bottom.jsp"/>